package in.indijava.scjp5questions;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegularExpressions {

	public static void main(String[] args) {
		String regex, text;
		regex = "\\d+";
		text = "asd22,.,.dsa 543asd";
		
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher(text);
		while (matcher.find()) {
			System.out.println("["+matcher.start()+","+ (matcher.end()-1) + "] " + matcher.group());
		}
	}
	
}
